-
Notifications
You must be signed in to change notification settings - Fork 989
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix shadowing-function detector and enhance inheritance-graph #166
Conversation
…highlight collisions via C3 linearization. * Updated shadowing-function-internal detector to ignore unimplemented functions. * Updated inheritance-graph printer to highlight collisions (shadowed + shadowing) instead of just shadowing.
Some notes:
|
…into slither.utils.inheritance_analysis.
For simplicity in distinguishing commits, the following changes have been since @montyly 's above post:
TODO:
|
… include c3 collisions which end up neutralized by later inheriting contracts in a multi-inheritance scheme.
* Added relevant test for inheritance_graph.
* Temporarily tweaked again to highlight shadowing functions instead of shadowed.
… in the parent contract, instead of inherited. * Added highlighting for state variables which overshadow others through inheritance. * Fixed a bug where special formatting for contract-type state variables wouldn't ever be used.
For documentation: To this point, all TODO's are complete (save for the last). Additionally: |
…t's most likely an error).
…terpretted as "%0" and will be used as the title/tooltip for all blank space.
* Changed detect_function_shadowing to return all c3 shadowing results, not just top-level (as super calls might make these results relevant). * Changed detect_function_shadowing to return the contract_scope as well (the contract where the issue is first detected, needed for indirect shadowing information). * Updates relevant test to test inheritance-graph with complex direct/indirect shadowing schemes.
…d. Adjusted tooltip.
…nly provide additional information for indirect conflicts. * Moved indirect conflicts into the affected contract node, instead of splitting information among all affected. * Fixed a bug where c3 shadowing detection could return the same function twice in a collision chain (not actually possible).
This PR is ready for review now. The final behavior for
Other supporting changes/bugfixes are detailed throughout this thread. |
…rapping them in an abstract class with static functions.
This pull request aims to resolve #165 . It fixes the
shadowing-function
detector and extends theinheritance-graph
printer.Changes:
-Fixed an issue where the
shadowing-function
detector would return all inherited functions (even if not shadowed).-Added an
internal
directory underdetectors
to house detectors which are not used for vulnerabilities, but as helpers throughout the program (such as for theinheritance-graph
printer).-Renamed the argument for
shadowing-function
detector toshadowing-function-internal
-Updated
inheritance-graph
printer to highlight all function collisions (shadowing + shadowed functions, not just shadowing).-Updated
inheritance-graph
printer to consider modifier collisions (not just functions).-Updated
inheritance-graph
printer to highlight collisions via C3 linearization (and added a relevantinternal
detector to help with detection of all c3 linearization function collisions).Note: Unimplemented functions and their later implementations will not count as collisions currently (and will not be highlighted). This can easily be changed if desired.